package com.intexh.speedandroid.module.mine;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.intexh.speedandroid.R;
import com.intexh.speedandroid.base.BaseActivity;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ChangeLoginPasswordActivity extends BaseActivity {

    @BindView(R.id.back_iv)
    ImageView backIv;
    @BindView(R.id.title_tv)
    TextView titleTv;
    @BindView(R.id.olde_password_et)
    EditText oldePasswordEt;
    @BindView(R.id.pwd_et)
    EditText pwdEt;
    @BindView(R.id.confirm_pwd_et)
    EditText confirmPwdEt;
    @BindView(R.id.confirm_btn)
    Button confirmBtn;
    private String oldPassword;
    private String newPassword;
    private String confirmPassword;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_change_login_password);
        ButterKnife.bind(this);
        titleTv.setText("修改登录密码");
    }

    @OnClick({R.id.back_iv, R.id.confirm_btn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back_iv:
                finish();
                break;
            case R.id.confirm_btn:
                oldPassword = oldePasswordEt.getText().toString();
                if(TextUtils.isEmpty(oldPassword)){
                    showToast("请输入旧密码");
                    return;
                }
                newPassword = pwdEt.getText().toString();
                if(TextUtils.isEmpty(newPassword)){
                    showToast("请输入新密码");
                    return;
                }
                confirmPassword = confirmPwdEt.getText().toString();
                if(!newPassword.equals(confirmPassword)){
                    showToast("两次输入密码不一致");
                    return;
                }
                confirm();
                break;
        }
    }

    private void confirm() {
        Map<String,String> params= new HashMap<>();

    }
}
